﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace StoreWeb.system.dealersManage
{
    public partial class edit : System.Web.UI.Page
    {
        //BLL.Role role = new BLL.Role();
        BLL.DealersManage userdealers = new BLL.DealersManage();
        public string s_province, s_city, s_county;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Bind();
                hidid.Value = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(hidid.Value))
                {
                    Model.DealersManage ne = userdealers.GetModel(Convert.ToInt32(hidid.Value));
                    username.Value = ne.username;
                    //mobile.Value = ne.mobile + ne.s_province;
                    //s_province.Value = ne.s_province;
                    //s_city.Value = ne.s_city;
                    //s_county.Value = ne.s_county;
                    mobile.Value = ne.mobile;
                    hids_province.Value = ne.s_province;
                    hids_city.Value = ne.s_city;
                    hids_county.Value = ne.s_county;
                    description.Text = ne.description;
                    //ddldealersgrade.SelectedValue = ne.dealersgrade.ToString();
                    select.Value = ne.dealersgrade.ToString();
                    discountrate.Value = ne.discountrate;
                }
            }
        }

        private void Bind()
        {
            BLL.DealersGrade message = new BLL.DealersGrade();
            //加载等级
            //ddldealersgrade.DataSource = message.GetList(" ");
            //ddldealersgrade.DataTextField = "grade";
            //ddldealersgrade.DataValueField = "grade";
            //ddldealersgrade.DataBind();
            //ddldealersgrade.Items.Insert(0, new ListItem { Value = "", Text = "------请分配等级------" });
            select.DataSource = message.GetList(" ");
            select.DataTextField = "grade";
            select.DataValueField = "grade";
            select.DataBind();
            select.Items.Insert(0, new ListItem { Value = "", Text = "------请分配等级------" });

        }
    }
}